<template>
	<view class="container">

		<!-- <view class="head-subsection"> -->
		<!-- <u-tabs :list="tablist" @click="onetypeClick"></u-tabs> -->
		<!-- <view class="item-subsection" :class="currentOneType === 1 ? 'active' : ''" @click="onetypeClick(1)">关注</view> -->
		<!-- 	<view class="item-subsection" :class="currentOneType === 0 ? 'active' : ''" @click="onetypeClick(0)">我的关注
			</view>
			<view class="item-subsection" :class="currentOneType === 1 ? 'active' : ''" @click="onetypeClick(1)">热门话题
			</view>
			<view class="item-subsection" :class="currentOneType === 2 ? 'active' : ''" @click="onetypeClick(2)">发友答疑
			</view>
			<view class="item-subsection" :class="currentOneType === 3 ? 'active' : ''" @click="onetypeClick(3)">发友科普
			</view> -->
		<!-- <view class="item-subsection">抖音直播</view> -->
		<!-- </view> -->
		<view v-if="forceRefresh">
			<PopularizationOfScience :openId="openId" :tabList="list[3]" />
		</view>
	</view>
</template>

<script>
	import MyAttention from "./MyAttention/index.vue";
	import PopularizationOfScience from "./PopularizationOfScience/index.vue";
	import HotTopic from "./HotTopic/index.vue";
	import AnswerQuestions from "./AnswerQuestions/index.vue";
	export default {

		data() {
			return {
				tablist: [{
					name: '我的关注',
				}, {
					name: '热门话题'
				}, {
					name: '发友答疑'
				}, {
					name: '发友科普'
				}],
				list: [
					[{
						name: "我的关注",
					}, ],
					[{
						name: "热门话题",
					}, ],
					[{
							name: "脱发答疑",
						},
						{
							name: "植发答疑",
						},
						{
							name: "术后答疑",
						},
					],
					[{
							name: "脱发科普",
						},
						{
							name: "植发科普",
						},
						{
							name: "术后科普",
						},
					],
				],
				currentOneType: 1,
				openId: "",
				forceRefresh: true,
			};
		},
		methods: {
			onetypeClick(index) {
				this.currentOneType = index.index;
			},
			tabClick(e) {},
			hairCommunityClick() {
				uni.navigateTo({
					url: "/pages/HairCommunityDetail/index",
				});
			},
		},
		components: {
			MyAttention,
			PopularizationOfScience,
			HotTopic,
			AnswerQuestions,
		},
		updated() {
			this.forceRefresh = true;
		},
		created() {
			let openId = uni.getStorageSync("openId");
			this.openId = openId;
		},
		mounted() {

			uni.$on("articleUpdate", (data) => {
				this.forceRefresh = false;
				// this.nextTick() {
				//   this.forceRefresh = true;
				// })
			});

		},
	};
</script>

<style lang="scss">
	@import "./index.scss";
</style>